CHROOT
Section: System Calls (2)
Index
Return to Main Contents
BSD mandoc
BSD 4.2
NAME
chroot
- change root directory
SYNOPSIS
Fd #include <unistd.h>
Ft int
Fn chroot const char *dirname
DESCRIPTION
Fa Dirname
is the address of the pathname of a directory, terminated by an ASCII NUL.
Fn Chroot
causes
Fa dirname
to become the root directory,
that is, the starting point for path searches of pathnames
beginning with
`/'
In order for a directory to become the root directory
a process must have execute (search) access for that directory.
It should be noted that
Fn chroot
has no effect on the process's current directory.
This call is restricted to the super-user.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise,
a value of -1 is returned and
errno
is set to indicate an error.
ERRORS
Fn Chroot
will fail and the root directory will be unchanged if:
- Bq Er ENOTDIR
-
A component of the path name is not a directory.
- Bq Er ENAMETOOLONG
-
A component of a pathname exceeded
{NAME_MAX}
characters, or an entire path name exceeded
{PATH_MAX}
characters.
- Bq Er ENOENT
-
The named directory does not exist.
- Bq Er EACCES
-
Search permission is denied for any component of the path name.
- Bq Er ELOOP
-
Too many symbolic links were encountered in translating the pathname.
- Bq Er EFAULT
-
Fa Path
points outside the process's allocated address space.
- Bq Er EIO
-
An I/O error occurred while reading from or writing to the file system.
SEE ALSO
chdir(2)
HISTORY
The
Fn chroot
function call appeared in
BSD 4.2
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- ERRORS
-
- SEE ALSO
-
- HISTORY
-
This document was created by
man2html,
using the manual pages.
Time: 19:41:54 GMT, December 25, 2022